ninab416 2.2.1
Loading...
Searching...
No Matches
ninab416


NINA-B416 Click

NINA-B416 Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.


Click Library

  • Author : Stefan Filipovic
  • Date : May 2025.
  • Type : UART type

Software Support

Example Description

This example demonstrates the use of NINA-B416 Click board by processing data from a connected BT device.

Example Libraries

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.NINAB416

Example Key Functions

  • ninab416_cfg_setup This function initializes Click configuration structure to initial values.
    void ninab416_cfg_setup(ninab416_cfg_t *cfg)
    NINA-B416 configuration object setup function.
    NINA-B416 Click configuration object.
    Definition ninab416.h:169
  • ninab416_init This function initializes all necessary pins and peripherals used for this Click board.
    err_t ninab416_init(ninab416_t *ctx, ninab416_cfg_t *cfg)
    NINA-B416 initialization function.
    NINA-B416 Click context object.
    Definition ninab416.h:144
  • ninab416_cmd_run This function sends a specified command to the Click module.
    void ninab416_cmd_run ( ninab416_t *ctx, uint8_t *cmd );
    void ninab416_cmd_run(ninab416_t *ctx, uint8_t *cmd)
    NINA-B416 cmd run function.
  • ninab416_cmd_set This function sets a value to a specified command of the Click module.
    void ninab416_cmd_set ( ninab416_t *ctx, uint8_t *cmd, uint8_t *value );
    void ninab416_cmd_set(ninab416_t *ctx, uint8_t *cmd, uint8_t *value)
    NINA-B416 cmd set function.
  • ninab416_cmd_get This function is used to get the value of a given command from the Click module.
    void ninab416_cmd_get ( ninab416_t *ctx, uint8_t *cmd );
    void ninab416_cmd_get(ninab416_t *ctx, uint8_t *cmd)
    NINA-B416 cmd get function.

Application Init

Initializes the driver and logger.

void application_init ( void )
{
log_cfg_t log_cfg;
ninab416_cfg_t ninab416_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
ninab416_cfg_setup( &ninab416_cfg );
if ( NINAB416_OK != ninab416_init( &ninab416, &ninab416_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
app_state = NINAB416_POWER_UP;
log_printf( &logger, ">>> APP STATE - POWER UP <<<\r\n\n" );
}
#define NINAB416_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition ninab416.h:127
void application_init(void)
Definition main.c:137
@ NINAB416_POWER_UP
Definition main.c:65
#define MIKROBUS_POSITION_NINAB416
Definition main.c:43
@ NINAB416_OK
Definition ninab416.h:196

Application Task

Application task is split in few stages:

  • NINAB416_POWER_UP:

    Powers up the device, performs a factory reset and reads system information.

  • NINAB416_EXAMPLE:

    Performs a BT terminal example by processing all data from a connected BT device and sending back an adequate response messages.

void application_task ( void )
{
switch ( app_state )
{
{
if ( NINAB416_OK == ninab416_power_up( &ninab416 ) )
{
app_state = NINAB416_EXAMPLE;
log_printf( &logger, ">>> APP STATE - EXAMPLE <<<\r\n\n" );
}
break;
}
{
ninab416_example( &ninab416 );
break;
}
default:
{
log_error( &logger, " APP STATE." );
break;
}
}
}
void application_task(void)
Definition main.c:170
@ NINAB416_EXAMPLE
Definition main.c:66

Note

We have used the Serial Bluetooth Terminal smartphone application for the test. A smartphone and the Click board must be paired to exchange messages.

Application Output

This Click board can be interfaced and monitored in two ways:

  • Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
  • UART Terminal - Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.

Additional Notes and Information

The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.